#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int NN=84;
struct node
{
	int c,t,w;
	bool operator<(const node&it)const
	{
		return 1ll*w*it.t>1ll*it.w*t;
	}
}a[NN];
ll f[NN*NN*NN];
int main()
{
	freopen("book.in","r",stdin);
	freopen("book.out","w",stdout);
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i].c);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i].t);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i].w);
	sort(a+1,a+1+n);
	int m;
	ll res=0;
	scanf("%d",&m);
	bool flag=false;
	for(int i=1;i<=n;i++)
	{
		int cnt=max(0,min((m-80*80*80)/a[i].t,a[i].c));
		m-=cnt*a[i].t;
		res+=1ll*cnt*a[i].w;
		a[i].c-=cnt;
		if(a[i].c)
		{
			flag=true;
			break;
		}
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=0;j<=30;j++)
		{
			if(a[i].c<(1<<j))
				break;
			for(int k=m;k>=1ll*a[i].t*(1<<j);k--)
				f[k]=max(f[k],f[k-1ll*a[i].t*(1<<j)]+1ll*a[i].w*(1<<j));
			a[i].c-=1<<j;
		}
		for(int k=m;(long long)k>=1ll*a[i].t*a[i].c;k--)
			f[k]=max(f[k],f[1LL*k-1ll*a[i].t*a[i].c]+1ll*a[i].w*a[i].c);
	}
	if(flag)
		res+=f[m];
	printf("%lld",res);
	return 0;
}
